//
//  WeChatTieTableViewCell.m
//  ZYZB
//
//  Created by ENERGY on 2018/7/9.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "SettingArrowTableViewCell.h"

@interface SettingArrowTableViewCell()
@property (nonatomic, strong)UIButton * weChatBtn;
@property (nonatomic, strong)UIButton * arrowBtn;
@property (nonatomic, strong)NSString * manageDataID;
@end
@implementation SettingArrowTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        __weak typeof (self)weakSelf = self;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.titleLab];
        [self.contentView addSubview:self.weChatBtn];
        [self.contentView addSubview:self.arrowBtn];
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(18/WIDTH_6_SCALE);
            make.top.equalTo(weakSelf.contentView.mas_top);
            make.bottom.equalTo(weakSelf.contentView.mas_bottom).mas_offset(-1/WIDTH_6_SCALE);
        }];
        [self.weChatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.centerY.equalTo(weakSelf.titleLab);
            make.right.equalTo(weakSelf.arrowBtn.mas_left).mas_offset(-6/WIDTH_6_SCALE);
        }];
        [self.arrowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-18/WIDTH_6_SCALE);
            make.centerY.equalTo(weakSelf.titleLab.mas_centerY);
            make.width.mas_offset(6/WIDTH_6_SCALE);
            make.height.mas_offset(12/WIDTH_6_SCALE);
        }];
        UIView * lineView = [[UIView alloc] init];
        lineView.backgroundColor = getColor(grayColor);
        [self.contentView addSubview:lineView];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-18/WIDTH_6_SCALE);
            make.height.mas_offset(1/WIDTH_6_SCALE);
            make.bottom.equalTo(weakSelf.contentView.mas_bottom);
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(18/WIDTH_6_SCALE);
        }];
        self.weChatBtn.hidden = YES;
        self.lineView = lineView;
    }return self;
}

- (UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = DEF_FontSize_14;
        _titleLab.textColor = [UIColor blackColor];
        _titleLab.textAlignment = NSTextAlignmentLeft;
        _titleLab.text = @"银行卡";
    }return _titleLab;
}
- (UIButton *)weChatBtn{
    if (!_weChatBtn) {
        _weChatBtn = [[UIButton alloc] init];
        _weChatBtn.titleLabel.font = DEF_FontSize_12;
        [_weChatBtn setTitle:@"去开户" forState:UIControlStateNormal];
        [_weChatBtn setBackgroundColor:[UIColor clearColor]];
        [_weChatBtn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    }
    return _weChatBtn;
}
- (UIButton *)arrowBtn{
    if (!_arrowBtn) {
        _arrowBtn = [[UIButton alloc] init];
//        [_arrowBtn setBackgroundColor:[UIColor greenColor]];
        [_arrowBtn setImage:[UIImage imageNamed:@"in"] forState:UIControlStateNormal];
    }
    return _arrowBtn;
}
- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.titleLab.text = model[@"title"];
//    [self.weChatBtn setTitle:model[@"content"] forState:UIControlStateNormal];
}
- (void)setManageDataModel:(NSDictionary *)manageDataModel{
    _manageDataModel = manageDataModel;
    self.titleLab.text = manageDataModel[@"infoTitle"];
    self.manageDataID = manageDataModel[@"loperationid"];
}
@end
